import md5 from 'md5-js'
export function getSign(params,timestamp){
    if (typeof params == "string") {
        return paramsStrSort(params,timestamp);
    } else if (typeof params == "object") {
        let arr = [];
        for (let i in params) {
            arr.push((i + "=" + params[i]));
        }
        return paramsStrSort(arr.join(("&")),timestamp);
    }
}
export function paramsStrSort(paramsStr,timestamp) {
    let url = paramsStr + "&appKey=thisisappkey";
    let urlStr = url.split("&").sort().join("&");
    let newUrl = urlStr + '&sendTime=' + timestamp;
    return md5(newUrl);
    // return newUrl;
}